package vn.cuhanh.bean;

import java.util.Calendar;

public class CharInfo {
	
//	public static final long CHAR_INFO_EXPIRE_TIME = 86400; //1 day
	public static final long CHAR_INFO_EXPIRE_TIME = 30; //1 day
	
	private Long id;
	private String name;
	private Long score;
	private String sex;
	private String mate_name;
	private Long charm;
	private Long flower;
	private Long eggs;
	private Long online_time;
	private Long m3g_money;
	private Long food;
	private Long soldier;
	private long lastUpdate;
	
	public CharInfo(Long id, String name, Long score, String sex, String mate_name,
			Long charm, Long flower, Long eggs, Long online_time,
			Long m3g_money, Long food, Long soldier) {
		super();
		this.id = id;
		this.name = name;
		this.score = score;
		this.sex = sex;
		this.setMate_name(mate_name);
		this.charm = charm;
		this.flower = flower;
		this.eggs = eggs;
		this.online_time = online_time;
		this.m3g_money = m3g_money;
		this.food = food;
		this.soldier = soldier;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Long getScore() {
		return score;
	}
	public void setScore(Long score) {
		this.score = score;
	}
	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	public Long getCharm() {
		return charm;
	}
	public void setCharm(Long charm) {
		this.charm = charm;
	}
	public Long getFlower() {
		return flower;
	}
	public void setFlower(Long flower) {
		this.flower = flower;
	}
	public Long getEggs() {
		return eggs;
	}
	public void setEggs(Long eggs) {
		this.eggs = eggs;
	}
	public Long getOnline_time() {
		return online_time;
	}
	public void setOnline_time(Long online_time) {
		this.online_time = online_time;
	}
	public Long getM3g_money() {
		return m3g_money;
	}
	public void setM3g_money(Long m3g_money) {
		this.m3g_money = m3g_money;
	}
	public Long getFood() {
		return food;
	}
	public void setFood(Long food) {
		this.food = food;
	}
	public Long getSoldier() {
		return soldier;
	}
	public void setSoldier(Long soldier) {
		this.soldier = soldier;
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getMate_name() {
		return mate_name;
	}
	public void setMate_name(String mate_name) {
		this.mate_name = mate_name;
	}
	public long getLastUpdate() {
		return lastUpdate;
	}
	public void setLastUpdate(long lastUpdate) {
		this.lastUpdate = lastUpdate;
	}
	public boolean isExpired() {
		long now = (long) (Calendar.getInstance().getTimeInMillis() / 1000);
		if(now - getLastUpdate() > CHAR_INFO_EXPIRE_TIME) {
			return true;
		}
		return false;
	}
}
